package com.rhodeisland.arknights.tas;

import android.accessibilityservice.AccessibilityService;
import android.app.Instrumentation;
import android.view.accessibility.AccessibilityEvent;

import android.view.KeyEvent;

public class LinsentingService extends AccessibilityService {


    protected static Instrumentation inst;

    @Override
    protected boolean onKeyEvent(KeyEvent event) {

        int key = event.getKeyCode();
        if (event.getAction() == KeyEvent.ACTION_DOWN)
        {
            if (key == MainActivity.key)
            {
                recentApps(this, AccessibilityService.GLOBAL_ACTION_BACK);
            }
        }
        return true;
    }

    public static void recentApps(AccessibilityService service, int action) {
        service.performGlobalAction(action);
    }

    @Override
    public void onInterrupt() {

    }

    @Override
    public void onCreate() {
        super.onCreate();
        MainActivity.Start();
    }

    @Override
    public void onAccessibilityEvent(AccessibilityEvent event) {

    }
}

